package com.quanquan.management.controller;

import com.quanquan.management.dto.DataDTO;
import com.quanquan.management.service.DataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @description:
 * @author:lihonglinag
 * @date:2019-03-21 15:38
 * @version:v 1.0.0
 */
@Controller
@RequestMapping("/")

public class IndexController extends ManagerBaseController {

    @Autowired
    private DataService dataService;


    @GetMapping(path = "/login")
    public String login() {
        return "login";
    }

    @GetMapping(path = "/index.html")
    public String index(Model model) {
        this.setModelAttr(model);
        return "index";
    }
    @GetMapping(path = "/index/main.html")
    public String mainIndex(Model model) {
        this.setModelAttr(model);
        DataDTO dataDTO = dataService.findData();
        model.addAttribute("editable", dataDTO);
        return "mainIndex";
    }


}
